/**
 * @ Author: luoqi
 * @ Create Time: 2024-07-11 18:28
 * @ Modified by: luoqi
 * @ Modified time: 2024-07-24 23:11
 * @ Description:
 */

#ifndef _BSP_H
#define _BSP_H

#include <stdint.h>

#include "../Core/Inc/main.h"
#include "../Core/Inc/usart.h"
#include "../Core/Inc/gpio.h"
#include "../Core/Inc/tim.h"
#include "../AZURE_RTOS/App/app_azure_rtos.h"

 // #define BSP_UART_USING_DMA

int bsp_init(void);

int bsp_deinit(void);

void bsp_blink(void);

void bsp_systick_callback_set(int(*callback)(void));

#ifdef BSP_UART_USING_DMA
#include "../Core/Inc/dma.h"

void bsp_uart_recv_callback_set(int(*callback)(void *data, int len));

int bsp_uart_send(const uint8_t *data, uint32_t len);

int bsp_uart_read(uint8_t *data, uint32_t len);

#else

int bsp_uart_send_block(const uint8_t *data, uint32_t len, uint32_t timeout);

int bsp_uart_read_block(uint8_t *data, uint32_t len, uint32_t timeout);
#endif

int bsp_printf(const char *fmt, ...);

void bsp_mdelay(uint32_t ms);

void bsp_reboot(void);

uint32_t bsp_strlen(const char *s);

void *bsp_memcpy(void *dest, const void *src, uint32_t len);

int bsp_rtos_start(void);

#endif
